package com.lfec.dividiraconta;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class PessoaAdapter extends ArrayAdapter<Pessoa> {
	
	LayoutInflater inflater;
	
	public PessoaAdapter(Context context){
		super(context, R.layout.nova_pessoa_row);
		
		inflater = (LayoutInflater)context.getSystemService
				(Context.LAYOUT_INFLATER_SERVICE);
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.nova_pessoa_row, parent, false);
		}
		
		TextView edit = (TextView) convertView.findViewById(R.id.pessoaItemName);
		
		Pessoa pes = this.getItem(position);
		
		if (pes!=null) {
			edit.setText(pes.getNome());
		}
		
		return convertView;
	}
	
	

}
